<!-- 使用 type="home" 属性设置首页，其他页面不需要设置，默认为page；推荐使用json5，更强大，且允许注释 -->
<route lang="json5">
{
  style: {
    navigationBarTitleText: '单据设置',
    navigationBarBackgroundColor: '#1989fa',
    navigationBarTextStyle: 'white',
  },
}
</route>
<template>
  <Loyout class="server-page" bgc="#F3F8FE">
    <view class="link-box">
      <wd-cell-group>
        <wd-cell title="自动生成单据号" center>
          <view class="custom-value h-64">
            <wd-switch v-model="orderConfig.autoOrderNo" change="handleSwitchChange" />
          </view>
        </wd-cell>
        <wd-cell title="单据增加设备编号" center>
          <view class="custom-value h-64">
            <wd-switch v-model="orderConfig.orderNoInDevice" change="handleSwitchChange" />
          </view>
        </wd-cell>
      </wd-cell-group>
    </view>
    <template #footer>
      <wd-button class="flex1 ml-20" size="large" @click="saveUserInfo">保 存</wd-button>
    </template>
  </Loyout>
</template>

<script lang="ts" setup>
import Loyout from '@/layouts/index.vue'
import { useOrderConfigStore } from '@/store/orderconfig'
import { useToast } from 'wot-design-uni'
const Toast = useToast()
const orderConfigStore = useOrderConfigStore()
console.log('orderConfigStore', orderConfigStore)
const orderConfig = computed(() => orderConfigStore.orderConfig)

const saveUserInfo = async () => {
  orderConfigStore.setConfig(orderConfig.value)
  Toast.success('成功')
}
</script>
